<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 300px;
            height: 300px;
            margin: 100px;
            background: red;
        }
        body {
            width: 2000px;
            height: 3000px;
        }
    </style>
</head>
<body>

    <div></div>

    <script>

        // e.clientX   e.clientY   e.x / e.y鼠标距离浏览器的坐标
        // e.pageX  e.pageY  鼠标距离整个实际页面的坐标
        // e.offsetX  鼠标距离事件源的坐标

        var oDiv = document.querySelector('div') ; 

        oDiv.onclick = function(e) {
            e = e || event ;
            console.log(e.clientX , e.x);
            console.log(e.pageX);
            console.log(e.offsetX);
        }

    </script>
    
</body>
</html>